package com.study.java8;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

public class DoubleColon {
    public static void  printValur(String str){
        System.out.println("print value : "+str);
    }

    public static void main(String[] args) {
        List<String> al = Arrays.asList("a","b","c","d");
        for (String a: al) {
            DoubleColon.printValur(a);
        }
        //下面的for each循环和上面的循环是等价的
        al.forEach(x->{
            DoubleColon.printValur(x);
        });

        //等价
        al.forEach(DoubleColon::printValur);

        //下面的方法和上面等价的
        Consumer<String> methodParam = DoubleColon::printValur; //方法参数
        al.forEach(x -> methodParam.accept(x));//方法执行accept
    }
}
